package bbs2.util;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    static final SimpleDateFormat formatYMD = new SimpleDateFormat("yyyy-MM-dd");
    static final SimpleDateFormat formatYMDHMS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    
    public static String toYMD(Date date) {
        return formatYMD.format(date);
    }
    
    public static String toYMDHMS(Date date) {
        return formatYMDHMS.format(date);
    }
    
    public static String toYMD(Timestamp timestamp) {
        return toYMD(new Date(timestamp.getTime()));
    }

    public static String toYMDHMS(Timestamp timestamp) {
        return toYMDHMS(new Date(timestamp.getTime()));
    }
}
